<?php
/**
 * Created by PhpStorm.
 * User: sosyuki
 * Date: 2018/8/13
 * Time: 16:50
 */

namespace Drupal\distribution\ViewsController\handler\field;


use stdClass;
use views_handler_field_user_link;

class DistributionEditInfoLink extends views_handler_field_user_link {

  function render_link($data, $values) {
    $account = new stdClass();
    $account->uid = $data;
    if ($data && user_access('distribution distribution edit')) {
      $this->options['alter']['make_link'] = TRUE;
      $text = !empty($this->options['text']) ? $this->options['text'] : t('编辑');
      $this->options['alter']['path'] = "admin/content/distribution/{$data}/edit";
      $this->options['alter']['query'] = drupal_get_destination();
      return $text;
    }
  }
}
